package com.traveliko.model;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.traveliko.customization.CustomDateSerializer;

import java.io.Serializable;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by Yasir Shabbir on 2/14/2017.
 */


/*
This MOdel class is return BarChart data.
 */
public class BarChart implements Serializable {

    private static final long serialVersionUID = -1267990432847825469L;
    private static final String YYYY_MM_DD = "yyyy-MM-dd";

    private static final DateFormat sdf = new SimpleDateFormat(YYYY_MM_DD);


    private String value;
    private Date date;


    public BarChart(String value, String dateString) throws ParseException {
        this.value = value;
        this.date = sdf.parse(dateString);
    }


    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }


    @JsonSerialize(using = CustomDateSerializer.class)
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }
}
